<?php

namespace Home\Controller;

use Think\Controller;

class AdminController extends Controller {

    public function index() {
        $this->display();
    }

//    public function login() {
//        $this->display();
//    }

    public function login_action() {
//        $this->display();
        /*
        $admin_name = $_POST['admin_name'];
        $admin_password = $_POST['admin_password'];
        $verify_code = $_POST['verify_code'];
        */
        $verify = new \Think\Verify();
        //echo I('post.admin_password');
        //die();
        if($verify->check(I('post.verify_code'))){
            if(I('post.admin_name')==C('admin') && I('post.admin_password') == C('admin')){
                //session('admin','com.vix.test'); 
                session('admin',I('post.admin_name'));
                $this->success('登陆成功',U('Home/Admin/index'),2);
            }else{
                $this->error('用户名或密码错误',U('Home/Index/login'),3);
            }
        }else{
            $this->error('验证码错误，请刷新验证码重新输入',U('Home/Index/login'),3);
        }
    }

}
